
const db = require("../utils/db")
const util = require("../utils/util")

async function add_upvote_post(user_id, post_id) {
    var sql = "Insert into upvote_post(user_id, post_id) values(?,?)";
    var args = [user_id, post_id];
    await db.query(sql, args);
}

async function add_upvote_comment(user_id, comment_id) {
    var sql = "Insert into upvote_comment(user_id, comment_id) values(?,?)";
    var args = [user_id, comment_id];
    await db.query(sql, args);
}

async function del_upvote_post(user_id, post_id) {
    var sql = "Delete from upvote_post where user_id=? and post_id=?";
    var args = [user_id, post_id];
    await db.query(sql, args);
}
async function del_upvote_comment(user_id, comment_id) {
    var sql = "Delete from upvote_comment where user_id=? and comment_id=?";
    var args = [user_id, comment_id];
    await db.query(sql, args);
}

module.exports = {
    add_upvote_post: add_upvote_post,
    add_upvote_comment: add_upvote_comment,
    del_upvote_post: del_upvote_post,
    del_upvote_comment: del_upvote_comment,
}
